package com.cskaoyan.mall.payment.pay;

import com.cskaoyan.mall.payment.pay.alipay.AlipayHelper;
import com.cskaoyan.mall.payment.pay.wx.WXPayHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author Pudding
 * @Date 2024/7/22 9:39
 */
@Component
public class PayHelpFactory {

    @Autowired
    AlipayHelper alipayHelper;
    @Autowired
    WXPayHelper wxPayHelper;

    //根据支付渠道的名字，获取支付工具
    public PayHelper getPayHelper(String payTypeName) {
        if ("Alipay".equals(payTypeName)) {
            return alipayHelper;
        }
        if ("WX".equals(payTypeName)){
            return wxPayHelper;
        }
        return null;
    }
}
